#include ".\..\header\Test.h"

void CheckKeyInput(SDL_Event pEvent, KeyState* keystate){
   if(pEvent.type == SDL_KEYDOWN){
       switch(pEvent.key.keysym.sym){
            case SDLK_UP:
                keystate->m_KeyUp = true;
            break;
            case SDLK_DOWN:
                keystate->m_KeyDown = true;
            break;
            case SDLK_LEFT:
                keystate->m_KeyLeft = true;
            break;
            case SDLK_RIGHT:
                keystate->m_KeyRight = true;
            break;
       }
   }
   if(pEvent.type == SDL_KEYUP){
       switch(pEvent.key.keysym.sym){
            case SDLK_UP:
                keystate->m_KeyUp = false;
            break;
            case SDLK_DOWN:
                keystate->m_KeyDown = false;
            break;
            case SDLK_LEFT:
                keystate->m_KeyLeft = false;
            break;
            case SDLK_RIGHT:
                keystate->m_KeyRight = false;
            break;
       }
   }
}
void PlayerMove(IDF_Surface* p_Surface, KeyState* keystate, float *timeDelta){
    if(keystate->m_KeyUp == true){
        p_Surface->rect.top -= 5 * *timeDelta;
    }
    if(keystate->m_KeyDown == true){
        p_Surface->rect.top += 5 * *timeDelta;
    }
    if(keystate->m_KeyLeft == true){
        p_Surface->rect.left -= 5 * *timeDelta;
    }
    if(keystate->m_KeyRight == true){
        p_Surface->rect.left += 5 * *timeDelta;
    }
}


